home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / PET / S-Super PET / (s)tz.d64 / MAIN.ASM < prev    next >
Assembly Source File  |  2009-01-18  |  3KB  |  128 lines

  1. opt nolist              ;MAIN part of TABLE program
  2.  
  3.         xref display,read_it,display,get_a_char,move_up,change_it
  4.         xref identification,input,write_it,set_parameters
  5.         xref filename, sample,answer,io_error
  6.         xref copystr_,prefixst_
  7.  
  8. main    clrb
  9.         ldx #title
  10.         jsr get_a_char
  11. one     ldb #'4                 ;maximum
  12.         ldx #source             ;data from disk or to be input?
  13.         jsr get_a_char
  14.         cmpb #'1
  15.         if eq                   ;load sample file
  16.            loop                 ;'0' possible, no filtering available
  17.               clrb
  18.               ldx #which_drive
  19.               jsr get_a_char    ;answer stays in ANSWER
  20.               cmpb #'1
  21.            quif eq
  22.               cmpb #'0
  23.            until eq
  24.  
  25.            ldd #filename
  26.               pshs d
  27.            ldd #sample
  28.            jsr copystr_
  29.               leas 2,s
  30.            ldb answer
  31.            cmpb #'1             ;drive 1 ?
  32.            if eq                ;if so, add 'disk/1.' prefix
  33.               ldd #filename
  34.                 pshs d
  35.               ldd #drive_prefix
  36.               jsr prefixst_
  37.                 leas 2,s
  38.            endif
  39.            jsr read_it
  40.            tst io_error
  41.         bne one                 ;redo if IO error
  42.            bra next
  43.         endif
  44.         cmpb #'2
  45.         if eq                   ;load another file already on disk
  46.            jsr identification
  47.            jsr read_it
  48.            tst io_error
  49.         bne one
  50.            bra next
  51.         endif
  52.  
  53.         cmpb #'3
  54.         if eq                   ;new table to be input
  55.            jsr input
  56.         else
  57.            bra quit             ;quit
  58.         endif
  59.  
  60. next   jsr display
  61. two    ldb #'5
  62.         ldx #menu
  63.         jsr get_a_char
  64.         ldb #6
  65.         jsr move_up
  66.         ldb answer
  67.         cmpb #'1
  68.         if eq                   ;change one entry
  69.            jsr change_it
  70.            bra next
  71.         endif
  72.         cmpb #'2
  73.         if eq                   ;change format parameters
  74.            jsr set_parameters
  75.            bra next
  76.         endif
  77.         cmpb #'3
  78.         if eq                   ;write data to disk
  79.            jsr identification
  80.            jsr write_it
  81.            ldb #1
  82.            jsr move_up
  83.            bra two
  84.         endif
  85.         cmpb #'4
  86.            lbeq one                    ;another table
  87.  
  88. quit    jsr $d9a9                      ;clear screen
  89.         clr $32                        ;quit
  90.         rts
  91.  
  92. title fcb 12,10,10,10,10,9,9
  93.         fcc "TABLE:  a demo program on tables of FP numbers"
  94.         fcb 13,10,9,9
  95.         fcc "           by Alain Proulx, for ISPUG"
  96.         fcb 13,10,9,9
  97.         fcc "                 Press any key "
  98.         fcb 0
  99. source  fcb 12,9
  100.         fcc "Do you wish to"
  101.         fcb 13,9,9
  102.         fcc "[1] see sample table?"
  103.         fcb 13,9,9
  104.         fcc "[2] see a table you previously saved on disk?"
  105.         fcb 13,9,9
  106.         fcc "[3] make a new table?"
  107.         fcb 13,9,9
  108.         fcc "[4] quit? "
  109.         fcb 0
  110. which_drive fcc "Drive  [1]  or  [0] ? "
  111.         fcb 0
  112. drive_prefix fcc "disk/1."
  113.         fcb 0
  114. menu    fcb 13
  115.         fcc "Do you wish to"
  116.         fcb 13,9,9
  117.         fcc "[1] change one entry?"
  118.         fcb 13,9,9
  119.         fcc "[2] change format parameters?"
  120.         fcb 13,9,9
  121.         fcc "[3] put this table on disk?"
  122.         fcb 13,9,9
  123.         fcc "[4] move to another table?"
  124.         fcb 13,9,9
  125.         fcc "[5] quit? "
  126.         fcb 0
  127.         end
  128.